import Vue from 'vue'
import VueRouter from 'vue-router'

// 引入框架
import Layout from '@/layout/Layout.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/login',
    component: () => import('@/views/login'),
  },
  {
    path: '/',
    redirect: '/home',
  },
  {
    path: '/home',
    component: Layout,
    redirect: '/home/goods',
    children: [
      {
        path: '/home/goods',
        component: () => import('@/views/goods'),
      },
      {
        path: '/home/comment',
        component: () => import('@/views/comment'),
      },
      {
        path: '/home/shop',
        component: () => import('@/views/shop'),
      },
    ],
  },
  {
    path: '/detail',
    component: () => import('@/views/detail'),
  },
]

const router = new VueRouter({
  routes,
})

export default router
